#pragma once
#include "stdafx.h"
#include "math.h"

/*
 *
stdafx.h 去掉，不需要。

Math.h 是VC 2005 的库文件。

MIPPCORECOMMON_API 是预编译宏，用于动态库输出 。你可以自己写一下
#define MIPPCORECOMMON_API __declspec(dllexport)
 * 
 */

namespace PNMS
{
	namespace VolumeEngine
	{
		namespace Core
		{
			namespace Common
			{
				class MIPPCORECOMMON_API mippMatrix
				{
				public:
					mippMatrix(void);
				public:
					~mippMatrix(void);


					void SetRotateFlag(bool bflag);
					void matrix_multiply(double dest[3][3], double mleft[3][3], double mright[3][3]);
					void matrix_vector_multiply(double dest[3], double matrix[3][3], double vector[3]);
					void Vector_matrix_multiply(double dest[3], double vector[3], double matrix[3][3]);
					void Vector_add(double dest[3], double vector1[3], double vector2[3]);
					void Vector_subtract(double dest[3], double vector1[3], double vector2[3]);
					void Transpose(double dest[3][3], double src[3][3]);

				public:
					double Pythag(const double a, const double b);
					bool QLAlgorithm (double m_afDiag[], double m_afSubd[], int m_iSize, double **m_kMat);
					bool TriQLAlgorithm(double d[], double e[], int m_iSize, double **m_kMat);
					void Tridiagonal3 (double *m_afDiag,double *m_afSubd,double** m_kMat);
					void IncreasingSort (double *m_afDiag,int m_iSize,double **m_kMat);
					void DecreasingSort (double *m_afDiag,int m_iSize,double **m_kMat);
					void GuaranteeRotation (int m_iSize,double **m_kMat);
					void DecrSortEigenStuff3 (double DiaE[],double SubE[],double **Matrix);
					void GetEigenvector(int i, double rkV[] ,double **m_kMat);
					float GetEigenvalue(int i,double *m_afDiag);

				protected:
					bool m_bIsRotation;
				};
			}
		}
	}
}
